<template>
  <div id="app">
	  <Header v-show='$store.state.bNav'></Header>
	  <router-view></router-view>
	  <Footer v-show='$store.state.bFoot'></Footer>
  </div>
</template>

<script>
import Header from './Header.vue'
import Footer from './Footer.vue'

export default {
  name: 'App',
  components: {
	  Header,Footer
  },
  watch:{
  	$route:{//路由监听，属性检测
      handler(nextValue,PrevValue){
        
        let path = nextValue.path;
        
        if(/home|list|pingl|myd/.test(path)){
          this.$store.commit('M_bNav',true)
          this.$store.commit('M_bFoot',true)
        }
        
        if(/login|reg/.test(path)){
          this.$store.commit('M_bNav',false)
          this.$store.commit('M_bFoot',false)
        }    
      },
      immediate:true//深度检测
    }
  },
}
</script>

<style>
#app {
	
}
</style>
